﻿@model IEnumerable<Expenses.Domain.Message>


@{
    ViewBag.Title = "Messages";
}

<h2>Messages</h2>
<div class="grid">
@(Html.Kendo().Grid<Expenses.Domain.Message>()
        .Name("Message")
        .Groupable()
        .Pageable()
        .Sortable()
        .Scrollable()
        .Filterable()
        .Columns(columns =>
        {
            columns.Bound(p => p.Message_Title).Width(200);
            columns.Bound(p => p.Period).Width(200);
            columns.Bound(p => p.Type).Width(200);
            columns.Command(command => { command.Edit(); command.Destroy();});
        })
        .ToolBar(toolbar => {toolbar.Create() ;})
        .Editable(editable => editable.Mode(GridEditMode.PopUp))
        .DataSource(dataSource => dataSource.Server()
            // Specify that the ProductID property is the unique identifier of the model
            .Model(model => model.Id(p => p.Message_ID))
            .Create(create => create.Action("Index", "Home"))
            .Read(read => read.Action("Messages", "Admin"))
            .Update(update => update.Action("UpdateMessage", "Admin"))
            .Destroy(destroy => destroy.Action("DeleteMessage", "Admin"))
        )
    )

</div>